package com.example.jt_manager_web;

import com.example.jt_manager_pojo.ItemCat;
import com.example.jt_manager_service.CategoryService;
import com.example.jt_manager_service.CategoryServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @RequestMapping("/item/cat/list")
    @ResponseBody
    public  List<ItemCat> getGoodsCategory(@RequestParam(name = "id",required = false,defaultValue = "0") long id){
        List<ItemCat> itemCats = categoryService.queryGoodsCategory(id);
        return itemCats;
    }
}
